<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var p=prompt("请输入数字");

    function q(p) {
        if(p==1){
            return 1;
        }
        else {
            return p * q(p - 1);
        }
    }
    document.write(q(p));
</script>
</body>
</html>